<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
</head>
<body>
<div class="container">
    <div class="panel panel-info">
        <div class="panel-heading">Spring Boot CRUD 实训练习！ 2020-11-10</div>
        <div class="panel-body">
            <div class="alert alert-success" role="alert">
                学生信息管理系统。你可以对学生信息进行删除/修改！ 或  <a href="/stu/add">添加学生信息</a>
            </div>
        </div>
        <form class="form-inline col-lg-8" method="post" action="/stu/list">
            <div class="form-group">
                <label for="clsid">班级</label>
                <select class="form-control" id="clsid" name="clsid" style="width: 200px;">
                    <option value="0">------请选择班级选择------</option>
                    <option th:each="ClassInfo:${clsinfo}" th:value="${ClassInfo.clsid}" th:text="${ClassInfo.clsName}"
                    th:selected="${ClassInfo.clsid==clsid}">大专</option>
                </select>
            </div>
            <div class="form-group">
                <label for="exampleInputEmail2">姓名</label>
                <input type="text" name="stu_name" class="form-control" id="exampleInputEmail2" th:value="${stuname}">
            </div>
            <button type="submit" class="btn btn-info">查询</button>
        </form>
        <br/> <br/>
        <table class="table table-hover">
            <tr>
                <td>编号</td>
                <td>班级名称</td>
                <td>用户名</td>
                <td>性别</td>
                <td>出生日期</td>
                <td>学历</td>
                <td>兴趣爱好</td>
                <td>幸运色</td>
                <td>幸运数字</td>
                <td>电子邮箱</td>
                <td>操作</td>
            </tr>
            <tr th:each="Student,userStat:${stus.list}">
                <td th:text="${userStat.index+1}">1001</td>
                <td th:text="${Student.clsName}">Jordan</td>
                <td th:text="${Student.stu_name}">Jordan</td>
                <td th:text="${Student.stu_sex==true?'男':'女'}">Man</td>
                <td th:text="${#dates.format(Student.stu_birthday,'yyyy/MM/dd')}">1967</td>
                <td th:text="${Student.stu_education}">本科</td>
                <td th:text="${Student.stu_interest}">篮球</td>
                <td>
                    <div th:style="'width:100%;height=100%;background-color:'+${Student.my_color}">
                        &nbsp;
                    </div>
                </td>
                <td>
                    <span class="badge" th:text="${Student.lucky_number}">
                        23
                    </span>
                </td>
                <td th:text="${Student.stu_email}">Jordan@NBA.com</td>
                <td><a th:href="@{'delete/'+${Student.stuid}}">删除</a>|<a th:href="@{'update/'+${Student.stuid}}">修改</a></td>
            </tr>
        </table>
        <!-- 分页 -->
        <nav aria-label="Page navigation">
            <ul class="pagination">
                <li>
                    <a th:href="@{/stu/list(pageIndex=${stus.pageNum-1},pageSize=5,clsid=${clsid} ,stuName=${stuname})}" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>

                <th:block th:each="nav:${stus.navigatepageNums}">
                    <li th:class="${nav==stus.pageNum}?'active':''">
                        <a th:href="@{/stu/list(pageIndex=${nav},pageSize=5,clsid=${clsid} ,stuName=${stuname})}"
                           th:text="${nav}"></a>
                    </li>
                </th:block>
                <li>
                    <a th:href="@{/stu/list(pageIndex=${stus.pageNum+1},pageSize=5,clsid=${clsid},stuName=${stuname})}" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
            </ul>
        </nav>

    </div>
</div>
</body>
</html>